home *** CD-ROM | disk | FTP | other *** search
- Path: locutus.rchland.ibm.com!usenet
- From: pstaite@vnet.ibm.com
- Newsgroups: comp.lang.c++
- Subject: Re: Recursive Definition?
- Date: 18 Jan 1996 15:34:07 GMT
- Organization: IBM OS/2 Device Driver Development Rochester, MN
- Message-ID: <4dlp9f$lje@locutus.rchland.ibm.com>
- References: <4df39j$f80@news.vcd.hp.com> <4dish8$43c@is.bbsrc.ac.uk> <4djo71$bnj@geraldo.cc.utexas.edu>
- Reply-To: pstaite@vnet.ibm.com
- NNTP-Posting-Host: warpone.rchland.ibm.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4djo71$bnj@geraldo.cc.utexas.edu>, Richard Kilgore <rkilgore@lore.ece.utexas.edu> writes:
- >Robert Tuck <Robert.Tuck@bbsrc.ac.uk> wrote:
- >>[...]
- >>> static const Switch On;
- >>> static const Switch Off;
- >>[...]
- >>>const Switch Switch::On = 1;
- >>>const Switch Switch::Off = 0;
-
- ..
-
- >On and Off are not exactly members, though, they're STATIC members. In C++,
- >this means that there is ONE "Switch::On" and ONE "Switch::Off" object in the
- >whole program (or at least this process). Whoever did this, might have been
- >setting up constants with which you can initialize and/or compare your own
- >Switch objects. This is perfectly legal, and it might be useful.
-
- It might be useful, but it doesn't work in this case. If you look
- closely at the code, the init is calling the Switch( int ) constructor
- to build the statics On and Off. However, the Switch( int ) constructor
- compares the int to Switch::On !!!
-
-
- Phil Staite, team OS/2
- internet: pstaite@vnet.ibm.com internal: pstaite@rchland
-
-